home *** CD-ROM | disk | FTP | other *** search
- /*
- *--- opencpy.cpp ----------------------------------------------------------
- * Copyright (c) 1992-96 Adobe Systems, Inc. All rights reserved.
- *
- * PageMaker plug-in OpenCopy.
- *-----------------------------------------------------------------------
- */
-
- /* ---------------- PageMaker SDK include files ---------------- */
- #include "PMPlugin.h"
- #include "CIInterfaceManager.h"
- #include "PMEvent.h"
- #include "PMEventRec.h"
- #include "CIBasic.h"
- #include "PMInterfaceIDs.h"
- #include "CICommandsAndQueries.h"
-
-
- /* ---------------- Plug-in include files ---------------- */
- #include "OpenCpy.h"
- #ifdef MACINTOSH
- #include "WinTypes.h"
- #include "PStrUtils.h"
- #endif // MACINTOSH
-
- /* ---------------- Cross-platform include files ---------------- */
-
- /* ---------------- Platform specific include files ---------------- */
- #ifdef MACINTOSH
- #include <types.h>
- #ifndef powerc
- #include <A4Stuff.h>
- #include <SetUpA4.h>
- #endif
- #else
- #include <windows.h>
- #endif
-
- /* ---------------- Type definitions ---------------- */
-
- /* ---------------- Definitions ---------------- */
- #define CB_PATH_BUFF 1000
- #define CB_NAME_BUFF 300
-
- /* ---------------- PageMaker (New)SDK include files ---------------- */
-
- /* ---------------- Globals ---------------- */
- extern sPMParamBlockPtr thePB;
- extern CIInterfaceManager *gpIntfMgr;
-
-
- /* ---------------- Function declarations ---------------- */
- #ifdef WINDOWS
- extern BOOL FGetOpenFileName(char *szPName, short cbPSz, char *szSName, short cbSSz );
- #endif // WINDOWS
-
- void OpenPubCopy(void)
- {
- //return;
- BOOL result;
- #ifdef WINDOWS
- char *szPathName = NULL;
- char *szShortName = NULL;
- #endif //WINDOWS
- #ifdef MACINTOSH
- Point point;
- short numTypes = 1;
- SFTypeList typeList;
- SFReply reply;
- #endif // MACINTOSH
- struct OpenPub {
- char szPathDestination[91];
- short how;
- } OpenRec;
- char myBuffer[300];
- char *myBufPtr=myBuffer;
- unsigned long sizeBuf = 0;
- CIBasic *pBasic = (CIBasic *)NULL;
- unsigned long oldProperty, openProperty;
-
- #ifdef WINDOWS
- szPathName = (char *)GlobalAlloc( GPTR, CB_PATH_BUFF );
- szShortName = (char *)GlobalAlloc( GPTR, CB_NAME_BUFF );
-
- if ( !szPathName || !szShortName )
- goto cleanup;
-
- result = FGetOpenFileName(szPathName, CB_PATH_BUFF, szShortName, CB_NAME_BUFF);
-
- memset(OpenRec.szPathDestination, 0, 91);
-
- strncpy( OpenRec.szPathDestination, szPathName, 91 );
- #endif // WINDOWS
-
- #ifdef MACINTOSH
- point.h = 100;
- point.v = 100;
- typeList[0] = 'AB65';
-
- SFGetFile(point, "\pLocate PageMaker file:", nil, numTypes, typeList,
- nil, &reply);
-
- if (reply.good == false)
- return;
-
- memset(OpenRec.szPathDestination, 0, 91);
-
- p_to_c( OpenRec.szPathDestination, reply.fName);
-
- #endif //MACINTOSH
- /*
- struct OpenPub {
- char szPathDestination[91];
- short how;
- } OpenRec;
- */
- OpenRec.how = 1;
-
- gpIntfMgr->AcquirePMInterface((unsigned long)PMIID_BASIC, (void **)&pBasic);
- oldProperty = pBasic->GetPlugInLibProperty();
- openProperty = ( oldProperty | kDisablePMEvent | kDisablePMSysEvent | kDisableNonCQEvent );
- gpIntfMgr->ReleasePMInterface((void *)pBasic);
-
- sizeBuf += LPPutString(myBufPtr, OpenRec.szPathDestination);
- myBufPtr += sizeBuf;
- sizeBuf += LPPutShort(myBufPtr, 1);
-
- // result = PBBinCommand(thePB, pm_open, kXRSPointer, &myBuffer, sizeBuf);
- result = PBBinCommand(thePB, pm_clear, kXRSNull, NULL, 0);
-
- gpIntfMgr->AcquirePMInterface((unsigned long)PMIID_BASIC, (void **)&pBasic);
- pBasic->SetPlugInLibProperty(oldProperty);
- gpIntfMgr->ReleasePMInterface((void *)pBasic);
-
- cleanup:
- #ifdef WINDOWS
- if ( szPathName )
- GlobalFree( szPathName );
- if ( szShortName )
- GlobalFree( szShortName );
- #endif //WINDOWS
- #ifdef MACINTOSH
-
- #endif // MACINTOSH
- return;
- }
-